// arg0 - damage taker
// arg1 - source
// arg2 - damage
var _dt=argument0, _src=argument1, _d=argument2, _arm=0;

// Add up the armour
_arm += _dt.armour;
if (_dt.object_index == Guy)
{
    for(i=0;i<ds_list_size(_dt.equipment);i+=1)
    {
        ii = ds_list_find_value(_dt.equipment, i);
        _arm += ii.armour;
    }
}
_d -= _arm;
if (_d > 0)
{
    _dt.life -= _d;
}

_dt.attack = _src;
with(_dt){event_user(15);}
return _d;
